package com.itqf;

import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2021/1/26
 * @Time: 下午2:44
 */
public class TestSpringZHQuartz {
    public  static  void  main(String[]args){

        //autoStartup = true;  自动启动
        ApplicationContext ac = new ClassPathXmlApplicationContext("spring-quartz.xml");



        try {
            //Thread.sleep(2000);

            Scheduler scheduler = ac.getBean(Scheduler.class);
            //删除定时任务
            //myJob myJob1
            //scheduler.deleteJob(JobKey.jobKey("myJob"));
            //暂停任务
            scheduler.pauseJob(JobKey.jobKey("myJob"));
            Thread.sleep(4000);
            //恢复任务
            scheduler.resumeJob(JobKey.jobKey("myJob"));


        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
